/**
 * 
 */
package com.et114.modules.content.services;

import java.util.List;

import com.et114.components.simpletable.DataList;
import com.et114.core.services.impl.BaseServicesImpl;
import com.et114.core.utility.FileUploadUtil;
import com.et114.modules.content.dao.SliderDao;
import com.et114.modules.content.vo.Slider;

/*
 * @author guanhw
 */
public class SliderServiceImpl extends BaseServicesImpl {
	private SliderDao sliderDao ;

	public void setSliderDao ( SliderDao sliderDao ) {
		this.sliderDao = sliderDao;
	} 
	
	
	public DataList getSliders( Slider vo ) throws Exception {
		return sliderDao.getSliders ( vo ) ; 
	}
	
	public List< Slider > getSlidersNPage( Slider vo ) throws Exception {
		return sliderDao.getSlidersNPage ( vo ) ;
	}
	
	public Slider getSlider( Long id ) throws Exception {
		return sliderDao.getSlider ( id ) ; 
	}
	
	public Long saveSlider( Slider vo ) throws Exception {
		return sliderDao.saveSlider ( vo ) ; 
	}
	
	public void updateSlider( Slider vo ) throws Exception {
		sliderDao.updateSlider ( vo ) ; 
	}
	
	public List< Slider > getSlidersCacheModel( Slider vo ) throws Exception {
		return sliderDao.getSlidersCacheModel ( vo ) ; 
	}
	
	public void removeSlider( Long id ) throws Exception {
		Slider slider = getSlider( id ) ; 
		if ( slider != null ) {
			FileUploadUtil.removeFile ( slider.getImagePath ( ) ) ; 
			sliderDao.removeSlider ( id ) ; 
		}
		
	}
}
